import {BasePage, BaseColumn} from "../../../../../ts/type";
import {replace, stampToDatetimeText} from "../../../../../ts/util";
import {h} from "vue";

export let entityLabelValueColumnInit = (page: BasePage) => {
    page.columns.push(replace(new BaseColumn('index', ''), {
        width: 60
    }))
    page.columns.push(replace(new BaseColumn('id', 'ID'), {
        sorter: 'default',
        defaultSortOrder: 'descend',
        width: 80
    }))
// field column auto
// #bind.field.tableCode#
    page.columns.push(new BaseColumn('tableCode', '实体编码'))
// $bind.field.tableCode$

// #bind.field.labelFieldCode#
    page.columns.push(new BaseColumn('labelFieldCode', 'Label属性名称'))
// $bind.field.labelFieldCode$

// #bind.field.valueFieldCode#
    page.columns.push(new BaseColumn('valueFieldCode', 'Value属性名称'))
// $bind.field.valueFieldCode$

// #bind.field.dataApiType#
    page.columns.push(new BaseColumn('dataApiType', '适用数据结构'))
// $bind.field.dataApiType$

// field label auto
// #bind.field.tableCode#
    page.columns.push(new BaseColumn('tableCodeLabel', '表名'))
// $bind.field.tableCode$

// #bind.field.labelFieldCode#
    page.columns.push(new BaseColumn('labelFieldCodeLabel', '属性名称'))
// $bind.field.labelFieldCode$

// #bind.field.valueFieldCode#
    page.columns.push(new BaseColumn('valueFieldCodeLabel', '属性名称'))
// $bind.field.valueFieldCode$

    page.columns.push(new BaseColumn('createBy', '创建人'))
    page.columns.push(new BaseColumn('updateBy', '修改人'))
    page.columns.push(replace(new BaseColumn('createTime', '创建时间'), {
        render: (row: any) => {
            return h('span', stampToDatetimeText(row.createTime))
        }
    }))
    page.columns.push(replace(new BaseColumn('updateTime', '修改时间'), {
        render: (row: any) => {
            return h('span', stampToDatetimeText(row.updateTime))
        }
    }))
}